package com.itrh.auth.service.impl;

import com.itrh.auth.domain.RoleMenu;
import com.itrh.auth.mapper.RoleMenuMapper;
import com.itrh.auth.service.IRoleMenuService;
import com.itrh.base.service.impl.BaseServiceImpl;
import com.itrh.org.domain.Employee;
import com.itrh.org.util.LoginMap;
import com.itrh.org.util.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author XHU_WHY
 * @since 2024-04-09
 */
@Service
public class RoleMenuServiceImpl extends BaseServiceImpl<RoleMenu> implements IRoleMenuService {
    @Resource
    private RoleMenuMapper roleMenuMapper;
    @Override
    public Result getMenuByRoleId(HttpServletRequest request) {
        Employee employee = LoginMap.getEmployee(request.getHeader("TOKEN"));
        List<RoleMenu> menus = roleMenuMapper.selectByEmpId(employee.getId());
        return Result.success(menus);
    }
}
